package com.youens.navigationdrawertest.ui.review

import android.util.Log
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.youens.navigationdrawertest.ui.favorite.Record

class FragementAdapter: FragmentPagerAdapter {
    var data= mutableListOf<Record>()
    var flag = false
    //TODO 构建一个可变data数组

    constructor(fm: FragmentManager?) : super(fm)
    //次构造方法必须调用主构造方法

    //TODO 构建一个数据参数为单词数组的构造器，初始化data数组
    constructor(fm:FragmentManager?,data:MutableList<Record>,flag:Boolean):this(fm){
        this.data=data
        this.flag=flag
    }
    override fun getCount(): Int {
        return data.size
    }
    override fun getItem(position: Int): Fragment? {
        return BlankFragment.newInstance(data[position].id,data[position].word,data[position].translate,flag)

    }
}